VERSION 5.00
Begin VB.Form MainForm 
   Caption         =   "Quan ly diem"
   ClientHeight    =   7425
   ClientLeft      =   120
   ClientTop       =   750
   ClientWidth     =   12525
   LinkTopic       =   "Form1"
   ScaleHeight     =   7425
   ScaleWidth      =   12525
   StartUpPosition =   2  'CenterScreen
   Begin VB.PictureBox Picture 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   4455
      Left            =   360
      Picture         =   "MainForm.frx":0000
      ScaleHeight     =   4455
      ScaleWidth      =   4935
      TabIndex        =   0
      Top             =   1560
      Width           =   4935
   End
   Begin VB.Label Label 
      Caption         =   "CH-0913028"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   5
      Left            =   8280
      TabIndex        =   6
      Top             =   4320
      Width           =   2775
   End
   Begin VB.Label Label 
      Caption         =   "Nguyen Thu Thuy"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   4
      Left            =   8280
      TabIndex        =   5
      Top             =   3840
      Width           =   2775
   End
   Begin VB.Label Label 
      Caption         =   "Sinh vien thuc hien:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   3
      Left            =   6600
      TabIndex        =   4
      Top             =   3360
      Width           =   2775
   End
   Begin VB.Label Label 
      Caption         =   "Du Thanh Binh"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   2
      Left            =   8280
      TabIndex        =   3
      Top             =   2640
      Width           =   2775
   End
   Begin VB.Label Label 
      Caption         =   "Giao vien huong dan:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   6600
      TabIndex        =   2
      Top             =   2160
      Width           =   2775
   End
   Begin VB.Label Label 
      Caption         =   "De tai: quan ly diem cho sinh vien truong trung cap"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Index           =   0
      Left            =   1800
      TabIndex        =   1
      Top             =   360
      Width           =   8895
   End
   Begin VB.Menu menHoThong 
      Caption         =   "He thong"
      Begin VB.Menu menDangNhap 
         Caption         =   "Dang nhap"
      End
      Begin VB.Menu menDangXuat 
         Caption         =   "Dang xuat"
      End
      Begin VB.Menu menThoat 
         Caption         =   "Thoat"
      End
   End
   Begin VB.Menu menDanhMuc 
      Caption         =   "Danh muc"
      Begin VB.Menu menNganh 
         Caption         =   "Nganh"
      End
      Begin VB.Menu menDanhMucMH 
         Caption         =   "Danh muc mon hoc"
      End
      Begin VB.Menu menLop 
         Caption         =   "Lop"
      End
      Begin VB.Menu menHSSV 
         Caption         =   "HSSV"
      End
      Begin VB.Menu menDiemDoiTuong 
         Caption         =   "Diem doi tuong"
      End
      Begin VB.Menu menDiemDaoDuc 
         Caption         =   "Diem dao duc"
      End
      Begin VB.Menu menDiemPhongTrao 
         Caption         =   "Diem phong trao"
      End
      Begin VB.Menu menNguoiDung 
         Caption         =   "Nguoi dung"
      End
   End
   Begin VB.Menu menNghiepVu 
      Caption         =   "Nghiep vu"
      Begin VB.Menu menSVDuocKhenThuong 
         Caption         =   "Sinh vien duoc khen thuong"
      End
      Begin VB.Menu menSVBiKyLuat 
         Caption         =   "Sinh vien bi ky luat"
      End
      Begin VB.Menu menSVThamGiaPT 
         Caption         =   "Sinh vien tham gia phong trao"
      End
      Begin VB.Menu menXepLoaiDaoDuc 
         Caption         =   "Xep loai dao duc"
      End
      Begin VB.Menu menDiemTongHop 
         Caption         =   "Diem tong hop"
      End
   End
   Begin VB.Menu menTimKiem 
      Caption         =   "Tim kiem"
      Begin VB.Menu menTimKiemSV 
         Caption         =   "Tim kiem sinh vien"
      End
      Begin VB.Menu menTimKiemLop 
         Caption         =   "Tim kiem lop"
      End
      Begin VB.Menu menTImKiemMonHoc 
         Caption         =   "Tim kiem mon hoc"
      End
      Begin VB.Menu menTimKiemDiem 
         Caption         =   "Tim kiem diem"
      End
   End
   Begin VB.Menu menThongKe 
      Caption         =   "Thong ke"
      Begin VB.Menu menThongKeDiem 
         Caption         =   "Thong ke diem"
      End
      Begin VB.Menu menThongKeMonHoc 
         Caption         =   "Thong ke mon hoc"
      End
      Begin VB.Menu menThongKeDaoDuc 
         Caption         =   "Thong ke dao duc"
      End
   End
   Begin VB.Menu menInDanhSach 
      Caption         =   "In danh sach"
      Begin VB.Menu menInDanhSachSinhVienLop 
         Caption         =   "In danh sach sinh vien lop"
      End
      Begin VB.Menu menDanhSachSVUuTien 
         Caption         =   "In danh sach sinh vien uu tien"
      End
   End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_oXMLConfig As DOMDocument
Private formNganh As FrmNganh
Attribute formNganh.VB_VarHelpID = -1
Private formDMMH As FrmDanhMucMonHoc
Private formLop As FrmLop
Private formDiemDoiTuong As FrmDiemDoiTuong
Private formDiemDaoDuc As FrmDiemDaoDuc
Private formDiemPhongTrao As FrmDiemPhongTrao
Private formHSSV As FrmHSSV
Private formSVDuocKhenThuong As FrmKhenThuong
Private formSVBiKyLuat As FrmKyLuat
Private formSVThamGiaPT As FrmSVThamGiaPT
Private formXepLoaiDaoDuc As FrmXepLoaiDaoDuc
Private formDiemTongHop As FrmDiemTongHop
Private formTimKiemSV As FrmTimKiemSV
Private formTimKiemLop As FrmTimKiemLop
Private formTimKiemMH As FrmTimKiemMonHoc
Private formThongKeDiem As FrmThongKeDiem
Private formThongKeMH As FrmThongKeMonHoc
Private formThongKeDD As FrmThongKeDaoDuc
Private formNguoiDung As FrmNguoiDung
Private formInDanhSachSVLop As FrmInDanhSachSVLop
Private formInDanhSachSVDoiTuong As FrmInDanhSachSVDoiTuong
Private WithEvents formDangNhap As FrmDangNhap
Attribute formDangNhap.VB_VarHelpID = -1

Private Sub Form_Load()
    Dim rs As ADODB.Recordset
    Dim objNguoiDung As clsNguoiDung
    Dim count As Integer
    
    Set objNguoiDung = New clsNguoiDung
    Set rs = objNguoiDung.SelectAll
    count = 0
    
    Do While Not rs.EOF
        count = count + 1
        rs.MoveNext
    Loop
    If count > 0 Then
        Set formDangNhap = New FrmDangNhap
        formDangNhap.Show 1, Me
    End If
    InitializeInfoSpecific
End Sub

Private Sub formDangNhap_EVENTThoat()
    Unload Me
End Sub

Private Sub formDangNhap_EVENTLogin(tendangnhap As String, matkhau As String)
    Dim username As String
    Dim password As String
    Dim objNguoiDung As clsNguoiDung
    Dim rs As ADODB.Recordset
    Dim count As Integer
    Dim infoText As String
    Dim success  As Boolean
    
    success = True
    infoText = ""
    username = tendangnhap
    password = matkhau
    
    Set objNguoiDung = New clsNguoiDung
    Set rs = objNguoiDung.SelectByTenDangNhap(username)
     Do While Not rs.EOF
        count = count + 1
        rs.MoveNext
    Loop
    
    If count = 0 Then
        success = False
        infoText = "Nguoi dung nay chua co trong he thong"
    Else
        Set objNguoiDung = New clsNguoiDung
        Set rs = objNguoiDung.SelectByTenDangNhapMatKhau(username, password)
        count = 0
        Do While Not rs.EOF
            count = count + 1
            Set g_CurrentUser = New clsNguoiDung
            g_CurrentUser.MaNguoiDung = rs!MaNguoiDung
            g_CurrentUser.MaLoaiNguoiDung = rs!MaLoaiNguoiDung
            g_CurrentUser.tendangnhap = rs!tendangnhap
            g_CurrentUser.matkhau = rs!matkhau
            rs.MoveNext
        Loop
        
        If count = 0 Then
            success = False
            infoText = "Ban da nhap sai mat khau"
        Else
            infoText = "Chao ban " & g_CurrentUser.tendangnhap & " vao he thong !"
        End If
    End If
    
    If Not success Then
        MsgBox infoText, vbCritical, "ThongBao"
        ' Re-login
        Set formDangNhap = New FrmDangNhap
        formDangNhap.Show 1, Me
    Else
        menDangNhap.Enabled = False
        If g_CurrentUser.MaLoaiNguoiDung = 1 Then
            menNguoiDung.Visible = True
        Else
            menNguoiDung.Visible = False
        End If
        MsgBox infoText, vbInformation, "ThongBao"
    End If
End Sub

Public Sub InitializeInfoSpecific()
    Dim xmlElemList As IXMLDOMNodeList
    Dim xmlElem As IXMLDOMNode
    Dim vInfoSpec As clsInfoSpecific
        
    Set g_colInfoSpecific = New Collection
    Set m_oXMLConfig = OpenXML(App.Path + "/announcement.xml")
    
    If Not m_oXMLConfig Is Nothing Then
        Set xmlElemList = m_oXMLConfig.documentElement.selectNodes("Element")
        For Each xmlElem In xmlElemList
            Set vInfoSpec = New clsInfoSpecific
            vInfoSpec.Name = xmlElem.Attributes.getNamedItem("Name").Text
            vInfoSpec.Area = xmlElem.Attributes.getNamedItem("Area").Text
            vInfoSpec.Report = xmlElem.selectSingleNode("Report").Text
            g_colInfoSpecific.Add vInfoSpec
        Next xmlElem
    End If
End Sub

Private Sub menDangNhap_Click()
    Set formDangNhap = New FrmDangNhap
    formDangNhap.Show 1, Me
End Sub

Private Sub menDangXuat_Click()
    menDangNhap.Enabled = True
    Set g_CurrentUser = Nothing
    Set formDangNhap = New FrmDangNhap
    formDangNhap.Show 1, Me
End Sub

Private Sub menDanhMucMH_Click()
    Set formDMMH = New FrmDanhMucMonHoc
    formDMMH.Show 1, Me
End Sub

Private Sub menDanhSachSVUuTien_Click()
    Set formInDanhSachSVDoiTuong = New FrmInDanhSachSVDoiTuong
    formInDanhSachSVDoiTuong.Show 1, Me
End Sub

Private Sub menDiemDaoDuc_Click()
    Set formDiemDaoDuc = New FrmDiemDaoDuc
    formDiemDaoDuc.Show 1, Me
End Sub

Private Sub menDiemDoiTuong_Click()
    Set formDiemDoiTuong = New FrmDiemDoiTuong
    formDiemDoiTuong.Show 1, Me
End Sub

Private Sub menDiemPhongTrao_Click()
    Set formDiemPhongTrao = New FrmDiemPhongTrao
    formDiemPhongTrao.Show 1, Me
End Sub

Private Sub menDiemTongHop_Click()
    Set formDiemTongHop = New FrmDiemTongHop
    formDiemTongHop.Show 1, Me
End Sub

Private Sub menHSSV_Click()
    Set formHSSV = New FrmHSSV
    formHSSV.Show 1, Me
End Sub

Private Sub menInDanhSachSinhVienLop_Click()
    Set formInDanhSachSVLop = New FrmInDanhSachSVLop
    formInDanhSachSVLop.Show 1, Me
End Sub

Private Sub menLop_Click()
    Set formLop = New FrmLop
    formLop.Show 1, Me
End Sub

Private Sub menNganh_Click()
    Set formNganh = New FrmNganh
    formNganh.EnableBtnChon = False
    formNganh.Show 1, Me
End Sub

Private Sub menNguoiDung_Click()
    Set formNguoiDung = New FrmNguoiDung
    formNguoiDung.Show 1, Me
End Sub

Private Sub menSVBiKyLuat_Click()
    Set formSVBiKyLuat = New FrmKyLuat
    formSVBiKyLuat.Show 1, Me
End Sub

Private Sub menSVDuocKhenThuong_Click()
    Set formSVDuocKhenThuong = New FrmKhenThuong
    formSVDuocKhenThuong.Show 1, Me
End Sub

Private Sub menSVThamGiaPT_Click()
    Set formSVThamGiaPT = New FrmSVThamGiaPT
    formSVThamGiaPT.Show 1, Me
End Sub

Private Sub menTimKiemLop_Click()
    Set formTimKiemLop = New FrmTimKiemLop
    formTimKiemLop.Show 1, Me
End Sub

Private Sub menTImKiemMonHoc_Click()
    Set formTimKiemMH = New FrmTimKiemMonHoc
    formTimKiemMH.Show 1, Me
End Sub

Private Sub menTimKiemSV_Click()
    Set formTimKiemSV = New FrmTimKiemSV
    formTimKiemSV.Show 1, Me
End Sub

Private Sub menThoat_Click()
    Unload Me
End Sub

Private Sub menThongKeDaoDuc_Click()
    Set formThongKeDD = New FrmThongKeDaoDuc
    formThongKeDD.Show 1, Me
End Sub

Private Sub menThongKeDiem_Click()
    Set formThongKeDiem = New FrmThongKeDiem
    formThongKeDiem.Show 1, Me
End Sub

Private Sub menThongKeMonHoc_Click()
    Set formThongKeMH = New FrmThongKeMonHoc
    formThongKeMH.Show 1, Me
End Sub

Private Sub menXepLoaiDaoDuc_Click()
    Set formXepLoaiDaoDuc = New FrmXepLoaiDaoDuc
    formXepLoaiDaoDuc.Show 1, Me
End Sub

